﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ScriptEditor.Commands
{
    class Command_Preload : Command
    {
        public string startId
        {
            get
            {
                return Value1;
            }
            set
            {
                Value1 = value;
            }
        }
        public string endId
        {
            get
            {
                return Value2;
            }
            set
            {
                Value2 = value;
            }
        }
        public string[] backgrounds
        {
            get
            {
                string[] result = Value3.Split(new char[] { '|' });
                return result;
            }
            set
            {
                if (value != null && value.Length != 0)
                {
                    Value3 = value[0];
                    for(int i = 1; i < value.Length; i++)
                    {
                        Value3 += "|" + value[i];
                    }
                }
                else
                {
                    Value3 = "";
                }
            }
        }
        public string[] prefabs
        {
            get
            {
                string[] result = Value4.Split(new char[] { '|' });
                return result;
            }
            set
            {
                if (value != null && value.Length != 0)
                {
                    Value4 = value[0];
                    for (int i = 1; i < value.Length; i++)
                    {
                        Value4 += "|" + value[i];
                    }
                }
                else
                {
                    Value4 = "";
                }
            }
        }
        public string[] characters
        {
            get
            {
                string[] result = Value5.Split(new char[] { '|' });
                return result;
            }
            set
            {
                if (value != null && value.Length != 0)
                {
                    Value5 = value[0];
                    for (int i = 1; i < value.Length; i++)
                    {
                        Value5 += "|" + value[i];
                    }
                }
                else
                {
                    Value5 = "";
                }
            }
        }
        public Command_Preload()
        {
            CommandType = COMMANDTYPE.Preload;
            startId = "请输入开始ID";
            endId = "请输入结束ID";
            backgrounds = new string[] { "" };
            prefabs = new string[] { "" };
            characters = new string[] { "" };
        }
        public Command_Preload(string StartId, string EndId, string[] Backgrounds = null, string[] Prefabs = null, string[] Characters = null)
        {
            CommandType = COMMANDTYPE.Preload;
            startId = StartId;
            endId = EndId;
            backgrounds = Backgrounds;
            prefabs = Prefabs;
            characters = Characters;
        }
        public override string ToString()
        {
            return CommandType.ToString() + ":\n" + "预加载资源:" + startId + "到" + endId;
        }
    }
}
